.TDesign-switch {
  position: relative;
  display: inline-flex;
  vertical-align: middle;
  align-items: center;
  outline: none;
  border: 0;
  padding: 0;
  height: 20px;
  border-radius: 10px;
  min-width: 36px;
  transition: all 0.2s var(--anim-time-fn-ease-out);
  background-color: var(--bg-color-thead);
  cursor: pointer;
  user-select: none;

  &.size-small {
    min-width: 28px;
    height: 16px;
    line-height: 16px;
    border-radius: 8px;

    .TDesign-switch__handle {
      width: 12px;
      height: 12px;
    }
  }

  &.size-large {
    min-width: 44px;
    height: 24px;
    line-height: 24px;
    border-radius: 12px;

    .TDesign-switch__handle {
      width: 20px;
      height: 20px;
    }
  }

  &.is-checked {
    background-color: var(--brand-main);

    .TDesign-switch__handle {
      left: calc(100% - 2px);
      transform: translate(-100%, 0);
    }
  }

  &__handle {
    position: absolute;
    display: flex;
    align-items: center;
    justify-content: center;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 12px;
    transition: all 0.2s var(--anim-time-fn-easing);

    &::before {
      content: "";
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
      border-radius: 12px;
      background-color: var(--text-anti);
      transition: all 0.2s var(--anim-time-fn-easing);
    }
  }

  &:active:not(.is-disabled) {
    .TDesign-switch__handle::before {
      left: 0;
      right: -6px;
    }

    &.is-checked {
      .TDesign-switch__handle::before {
        right: 0;
        left: -6px;
      }
    }

    .TDesign-switch__content {
      opacity: 0;
    }
  }
}
